package club.kingyin.kyblogprofile.bean;

import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Data
@Slf4j
@Configuration
@ConfigurationProperties(prefix = "minio")
public class BeanConfig {

    private String endpoint;
    private String username;
    private String password;

    @Bean
    public MinioClient minioClient() {
        MinioClient client;
        log.info("minio 连接地址：{}",endpoint);
        client = MinioClient.builder().endpoint(endpoint).credentials(username, password).build();
        return client;
    }
}
